<?php
class FileUtil {
	private static $image_types = array (	'gif', 'jpeg', 'png', 
											'swf', 'psd', 'bmp',
		            						'tiff', 'tiff', 'jpg', 
		            						'aiff', 'wbmp', 'xbm');
	
	public static function isAnImage($imageFile) {
	    //echo "Checking file $imageFile \n";
	    if(empty($imageFile)) {
	    	return false;
	    }
	    
	    $file_segs = explode(".",$imageFile);
	    
		//echo "Exploded file $imageFile:" . count($file_segs) . "\n";
	    
	    if(count($file_segs)<=1) {
	    	return false;
	    }
	    
	    //echo "File extension: " . $file_segs[1] . "\n";
	    
	    if(in_array(strtolower($file_segs[1]),self::$image_types)) {
	    	return true;
		}
		return false;
	}
}
?>